#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int t;
	cin >> t;
	while (t--) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;

		int mn = min(c, d);
		int mx = max(c, d);

		if (
		    ((mn < a && a < mx) && ((mn > b && mx > b) || (mx < b && mx < b)))
		    ||
		    ((mn < b && b < mx) && ((mn > a && mx > a) || (mx < a && mx < a)))
		)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}
